package org.xjst.ui
{
	import com.google.maps.LatLng;
	
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import mx.containers.VBox;
	import mx.controls.Button;
	import mx.controls.TextArea;
	import mx.controls.TextInput;
	import mx.core.UIComponent;
	
public class CreatMarker
{
	private var _vboxOuter:VBox;
	private var _textLatlan:TextInput;
	private var _textInputName:TextInput;
	private var _textInputCat:TextInput;
	private var _textInputDes:TextArea;
	private var _textInputURL:TextInput;
	private var _textInputPhotoURL:TextInput;
	private var _button:Button;
	private var _outPut:TextArea;
	
	// Constructor
	public function CreatMarker() {
	}
	
	public function get ui():UIComponent {
		if(_vboxOuter == null) {
		
			_vboxOuter = new VBox();
			
			_textLatlan = new TextInput();
			_textInputName = new TextInput();
			_textInputCat = new TextInput();
			_textInputDes = new TextArea();
			_textInputURL = new TextInput();
			_textInputPhotoURL = new TextInput();
			_button = new Button();
			_button.label = "Get";
			_button.addEventListener(MouseEvent.CLICK, onSubmit);
			_outPut = new TextArea();
			_outPut.percentWidth = 100;
			_outPut.percentWidth = 100;
			
			_vboxOuter.addChild(_textLatlan);
			_vboxOuter.addChild(_textInputName);
			_vboxOuter.addChild(_textInputCat);
			_vboxOuter.addChild(_textInputDes);
			_vboxOuter.addChild(_textInputURL);
			_vboxOuter.addChild(_textInputPhotoURL);
			_vboxOuter.addChild(_button);
			_vboxOuter.addChild(_outPut);
		}
		return _vboxOuter;
	}
	
		private function onSubmit(e:Event):void {
		var xy:String = _textLatlan.text.substr(1, _textLatlan.text.length - 2);
		_outPut.text = xy + ", '" + _textInputName.text + "', '" + _textInputCat.text + "', '" + _textInputDes.text + "', '" + _textInputURL.text +
			"', '" + _textInputPhotoURL.text + "'";
	}

	public function setLoc(l:LatLng):void {
		_textLatlan.text = l.toString();
	}
} // End of class
} // End of package